import axios from 'axios'

const _axios = axios.create({
  baseURL: 'http://localhost:3000/',
  timeout: 5000
})

_axios.interceptors.response.use(
  function(response) {
    if(response.status === 200 && response.data.code === 200) return response.data
    return Promise.reject(response)
  }
)

export default _axios